var express = require('express')
var router = express.Router()
const { SysMenuController } = require('../controller/sys_menu')
const { auth } = require('../middleware/auth')
const passport = require('passport')
// 不需要鉴权
router.get(
  '/menu/list',
  passport.authenticate('jwt', { session: false }),
  SysMenuController.getMenu
)
// 不需要鉴权
router.get(
  '/menu/premission',
  passport.authenticate('jwt', { session: false }),
  SysMenuController.getPremission
)
router.post(
  '/menu/add',
  passport.authenticate('jwt', { session: false }),
  auth,
  SysMenuController.addMenu
)
router.put(
  '/menu/edit',
  passport.authenticate('jwt', { session: false }),
  auth,
  SysMenuController.editMenu
)
router.delete(
  '/menu/del',
  passport.authenticate('jwt', { session: false }),
  auth,
  SysMenuController.delMenu
)
module.exports = router
